package com.twu.biblioteca;

import java.util.ArrayList;


public class BookList extends ArrayList {
    private ArrayList<Book> bookList = new ArrayList<>();

    public void initBookList() {
        bookList.add(new Book(0, "testbook", "available"));
        bookList.add(new Book(1, "testbook1", "available"));
        bookList.add(new Book(2, "testbook2", "checkedOut"));
    }

    public String getBookList() {
        String BookList = new BookListFormatter(bookList).format(BookState.AVAILABLE);
        return BookList;
    }

    public String getAvailableBookList() {
        String availableBookList = new BookListFormatter(bookList).format(BookState.AVAILABLE);
        return availableBookList;
    }

    public Book get(int i) {
        return bookList.get(i);
    }

    public boolean contains(int bookNumber) {
        for (Book book : bookList) {
            if (book.getNumber() == bookNumber) {
                return true;
            }
        }
        return false;
    }
}